<h1><%= title "Marriage Proposals" %></h1>

<h2>Proposals to you or your family</h2>
<% if @marriages_to && @marriages_to.size > 0 %>
	<table>
	  <tr>
	    <th>Liege</th>
		<th>From</th>
		<th>To</th>
		<th>Dowry</th>
	  </tr>
	
	<% for marriage in @marriages_to %>
	  <tr>
	    <td><%=link_to_record marriage.character %></td>
	    <td><%=link_to_record marriage.from_character %></td>
		<td><%=link_to_record marriage.to_character %></td>
		<td><%=h marriage.dowry %></td>
	    <td><%= link_to 'Accept', marriage, :method => 'put' %></td>
	    <td><%= link_to 'Reject', marriage, :method => 'delete' %></td>
	  </tr>
	<% end %>
	</table>
<% else %>
<p>None</p>
<% end %>
<br />

<h2>Proposals made by you</h2>
<% if @marriages_from && @marriages_from.size > 0 %>
	<table>
	  <tr>
	    <th>Liege</th>
		<th>From</th>
		<th>To</th>
		<th>Dowry</th>
	  </tr>
	
	<% for marriage in @marriages_from %>
	  <tr>
	    <td><%=link_to_record marriage.to_character.liege %></td>
	    <td><%=link_to_record marriage.from_character %></td>
		<td><%=link_to_record marriage.to_character %></td>
		<td><%=h marriage.dowry %></td>
		<td>
		<% if marriage.rejected %>
		<td>Rejected (<%= link_to 'remove', marriage, :method => 'delete' %>)</td>
		<% else %>
	    <%= link_to 'Cancel', marriage, :method => 'delete' %>
		<% end %>
		</td>
	  </tr>
	<% end %>
	</table>
<% else %>
<p>None</p>
<% end %>
<br />

<h2>Characters eligible for marriage under your control</h2>
<% if @eligible && @eligible.size > 0 %>
	<ul>
		<% for character in @eligible %>
		<li><%= link_to_record character %> - <a href="/marriages/<%=character.id%>">find spouse</a></li>
		<% end %>
	</ul>
<% else %>
<p>None</p>
<% end %>
<%= link_to 'Home', '/' %>
